@extends("layouts.master")

@section("body")
<div class="col-lg-12">
	<div class="panel panel-default">
        <div class="panel-heading">
            <h2><i class="fa fa-indent red"></i><strong>修改商品</strong></h2>
            <input id="commodity_id" type="hidden" name="" value="{{ $commodity->id }}">
        </div>
        <div class="panel-body">
			<form class="form-horizontal" role="form">
                <div class="form-group">
                    <label class="col-lg-2 col-md-2 col-sm-12 control-label">商品名称</label>
                    <div class="col-lg-10 col-md-10">
                        <input id='c_name' type="text" class="form-control" value="{{ $commodity->c_name }}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-2 col-md-2 col-sm-12 control-label">商品数量</label>
                    <div class="col-lg-10 col-md-10">
                        <input id="c_number" type="number" class="form-control" value="{{ $commodity->c_number }}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-2 col-md-2 col-sm-12 control-label">商品所需积分</label>
                    <div class="col-lg-10 col-md-10">
                        <input id="c_integration" type="text" class="form-control" value="{{ $commodity->c_integration }}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-2 col-md-2 col-sm-12 control-label">商品类型</label>
                    <div class="col-lg-10 col-md-10">
                        <select id="ct_type_id" class="form-control" data-rel="chosen">
                            @foreach($commodityTypes as $commodityType)
                                <option value="{{ $commodityType->id }}"
                                    @if($commodity->commodityType->id == $commodityType->id)
                                        selected="selected"
                                    @endif
                                    >{{ $commodityType->ct_name }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-2 col-md-2 col-sm-12 control-label">商品图片1</label>
                    <div id="img-wrapper1" class="col-lg-10 col-md-10">
                        <div style="margin-bottom:10px" class="col-md-3">
                            <input id="c_pricture1" type="hidden" name="" value="{{ array_key_exists(0,$commodity->c_picture_arr)?$commodity->c_picture_arr[0]:'' }}">
                            <img id="cn_img1" class="img-thumbnail" src="{{ array_key_exists(0,$commodity->c_picture_url)?$commodity->c_picture_url[0]:'' }}"  alt="上传图片显示">
                            </div>
                            <div id="upload1_btn" class="btn btn-primary">
                            上传图片
                            </div>
                            <div id="delete1_btn" class="btn btn-primary">
                            删除图片
                            </div>
                        <br>
                        <input type="file" id="upload1" style="display:none">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-2 col-md-2 col-sm-12 control-label">商品图片2</label>
                    <div id="img-wrapper2" class="col-lg-10 col-md-10">
                        <div style="margin-bottom:10px" class="col-md-3">
                            <input id="c_pricture2" type="hidden" name="" value="{{ array_key_exists(1,$commodity->c_picture_arr)?$commodity->c_picture_arr[1]:'' }}">
                            <img id="cn_img2" class="img-thumbnail" src="{{ array_key_exists(1,$commodity->c_picture_url)?$commodity->c_picture_url[1]:'' }}" alt="上传图片显示">
                            </div>
                            <div id="upload2_btn" class="btn btn-primary">
                            上传图片
                            </div>
                            <div id="delete2_btn" class="btn btn-primary">
                            删除图片
                            </div>
                        <br>
                        <input type="file" id="upload2" style="display:none">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-2 col-md-2 col-sm-12 control-label">商品图片3</label>
                    <div id="img-wrapper3" class="col-lg-10 col-md-10">
                        <div style="margin-bottom:10px" class="col-md-3">
                            <input id="c_pricture3" type="hidden" name="" value="{{ array_key_exists(2,$commodity->c_picture_arr)?$commodity->c_picture_arr[2]:'' }}">
                            <img id="cn_img3" class="img-thumbnail" src="{{ array_key_exists(2,$commodity->c_picture_url)?$commodity->c_picture_url[2]:'' }}" alt="上传图片显示">
                            </div>
                            <div id="upload3_btn" class="btn btn-primary">
                            上传图片
                            </div>
                            <div id="delete3_btn" class="btn btn-primary">
                            删除图片
                            </div>
                        <br>
                        <input type="file" id="upload3" style="display:none">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-2 col-md-2 col-sm-12 control-label">商品图片4</label>
                    <div id="img-wrapper4" class="col-lg-10 col-md-10">
                        <div style="margin-bottom:10px" class="col-md-3">
                            <input id="c_pricture4" type="hidden" name="" value="{{ array_key_exists(3,$commodity->c_picture_arr)?$commodity->c_picture_arr[3]:'' }}">
                            <img id="cn_img4" class="img-thumbnail" src="{{ array_key_exists(3,$commodity->c_picture_url)?$commodity->c_picture_url[3]:'' }}" alt="上传图片显示">
                            </div>
                            <div id="upload4_btn" class="btn btn-primary">
                            上传图片
                            </div>
                            <div id="delete4_btn" class="btn btn-primary">
                            删除图片
                            </div>
                        <br>
                        <input type="file" id="upload4" style="display:none">
                    </div>
                </div>
                <div class="form-actions" style="text-align: center;">
                    <button id="update_btn" type="button" class="btn btn-primary">修改</button>
                    <button id="cancel_btn" type="button" class="btn btn-default">取消</button>
                </div>
            </form>
		</div>						
    </div>
</div>

@stop

@section('js')
    <script type="text/javascript" src="/lib/js/qiniu.min.js"></script>
    <script type="text/javascript" src="/lib/js/plupload.full.min.js"></script>
    <script type="text/javascript" src="/js/js/pages/commodity/update.js"></script>
@stop